<template>
  <view :style="themeColor">
    <view class="page">
      <view
        class="flex flex-direction flex-wrap align-stretch benben-position-layout flex dailyexpenditureModification_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub dailyexpenditureModification_fd0_0'>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="back" data-url="1">
            <text class='fu-iconfont2  dailyexpenditureModification_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='dailyexpenditureModification_fd0_0_c1_c0'>修改</text>
          </view>
          <view class='flex flex-wrap align-center justify-end dailyexpenditureModification_fd0_0_c0'>
            <image class='dailyexpenditureModification_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'></image>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout dailyexpenditureModification_flex_1">
        <view class='flex flex-direction flex-wrap align-stretch dailyexpenditureModification_fd1_0'>
          <view class='flex flex-wrap align-center'>
            <text class='dailyexpenditureModification_fd1_0_c0_c0'>*</text>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>品种：</text>
            <text v-for="(item,index) in pinzList"
              :class="pinzhong==item.value ? 'dailyexpenditureModification_fd1_0_c0_c2' : 'dailyexpenditureModification_fd1_0_c0_c3'"
              :key="index" @click.stop="choosep(item)">{{item.name}}</text>
            <!--         <text class='dailyexpenditureModification_fd1_0_c0_c2'>小麦</text>
            <text class='dailyexpenditureModification_fd1_0_c0_c3'>玉米</text> -->
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>送粮人：</text>
            <!-- <text class='dailyexpenditureModification_fd1_0_c1_c1'>张二河</text> -->
            <input class='dailyexpenditureModification_fd1_0_c1_c1' type="text" placeholder="请输入"
              v-model="songliangren" />
            <image v-if="peopList.length" @click="pickerDiy1706625508467=true"
              class='dailyexpenditureModification_fd1_0_c1_c2' mode="aspectFit" :src='STATIC_URL+"1.png"'></image>
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c0'>*</text>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>{{leixing==1 ?'收购' : '出售' }}价：</text>
            <input class='dailyexpenditureModification_fd1_0_c3_c2' @input="changeJin" type="digit" placeholder="请输入"
              v-model="shougoujia" />
            <text class='dailyexpenditureModification_fd1_0_c2_c3'>元/斤</text>
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c0'>*</text>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>毛重：</text>
            <input class='dailyexpenditureModification_fd1_0_c3_c2' @input="changeJin" type="digit" placeholder="请输入"
              v-model="maozhong" />
            <text class='dailyexpenditureModification_fd1_0_c2_c3'>元/斤</text>
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c0'>*</text>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>皮重：</text>
            <input class='dailyexpenditureModification_fd1_0_c3_c2' @input="changeJin" type="digit" placeholder="请输入"
              v-model="pizhong" />
            <text class='dailyexpenditureModification_fd1_0_c2_c3'>元/斤</text>
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>净重：</text>
            <text class='dailyexpenditureModification_fd1_0_c5_c1'>{{jingzhong || 0}}</text>
            <text class='dailyexpenditureModification_fd1_0_c5_c2'>元/斤</text>
          </view>
          <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_0_c1'>
            <text class='dailyexpenditureModification_fd1_0_c0_c1'>金额：</text>
            <text class='' v-if="jine">{{desctext}}=</text>
            <!-- <text class='dailyexpenditureModification_fd1_0_c3_c2' v-else>0</text> -->
            <text class='dailyexpenditureModification_fd1_0_c6_c2'>{{jine || 0}}元</text>
          </view>
        </view>
        <view class='flex flex-wrap align-center dailyexpenditureModification_fd1_1 ' @click="submit">
          <button class='dailyexpenditureModification_fd1_1_c0'>确认</button>
        </view>
      </view>

      <!---flex布局flex布局结束-->

      <benben-picker ref="benbenWritePickerCodepicker1" :visible.sync="pickerDiy1706625508467" mode='selector'
        :value.sync="songliangren" :label.sync="songliangren" :options.sync='peopList' :mask-show='true' :timeout='true'
        :picker-height='88' :level='3' default-type='value'
        :default-props='{"label":"shouliangrenmingcheng","value":"aid"}'>
        <template #picker-header>
          <view class='flex flex-wrap align-center justify-between releaseSale_picker1_0'>
            <text class='releaseSale_picker1_0_c0' @tap="$refs.benbenWritePickerCodepicker1.cancel()">取消</text>
            <text>选择送粮人</text>
            <text class='releaseSale_picker1_0_c2' @tap="$refs.benbenWritePickerCodepicker1.pickerConfirm()">确认</text>
          </view>
        </template>
      </benben-picker>
    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        pickerDiy1706625508467: false,
        "aid": "",
        pinzList: [{
            value: 1,
            name: "小麦"
          },
          {
            value: 2,
            name: "玉米"
          }
        ],
        pinzhong: 1,
        leixing: '',
        shougoujia: '',
        maozhong: '',
        songliangren: '',
        pizhong: '',
        jingzhong: '',
        jine: '',
        peopList: [],
        desctext: '',
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        aid
      } = options
      if (aid !== undefined) this.aid = aid
      this.getReson()
      this.getDetail()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      getDetail() {
        this.$api.post(global.apiUrls.post65d6df9c29c29, {
          aid: this.aid
        }).then(res => {
          if (res.data.code == 1) {
            this.pinzhong = res.data.data.pinzhong
            this.songliangren = res.data.data.songliangren
            this.shougoujia = res.data.data.shougoujia
            this.maozhong = res.data.data.maozhong
            this.pizhong = res.data.data.pizhong
            this.jingzhong = res.data.data.jingzhong
            this.jine = res.data.data.jine
            this.leixing = res.data.data.leixing
            this.desctext = `(${this.maozhong}-${this.pizhong})*2*${this.shougoujia}`
          }
        })
      },
      changeJin() {
        if (this.shougoujia && this.maozhong && this.pizhong) {
          if (this.maozhong > this.pizhong) {
            this.$api.post(global.apiUrls.post65d6ea3658827, {
              shougoujia: this.shougoujia,
              maozhong: this.maozhong,
              pizhong: this.pizhong,
            }).then(res => {
              if (res.data.code == 1) {
                this.desctext = `(${this.maozhong}-${this.pizhong})*2*${this.shougoujia}`
                this.jine = res.data.data.pirce
                this.jingzhong = res.data.data.jingzhong
              } else {
                this.$message.info(res.data.msg)
              }
            })
          }
        }
      },
      getReson() {
        this.$api.post(global.apiUrls.post65d6e6f92dd0a).then(res => {
          if (res.data.code == 1) {
            this.peopList = res.data.data.data
          }
        })
      },
      choosep(item) {
        this.pinzhong = item.value
      },
      submit() {
        if (!this.songliangren) {
          this.$message.info('请输入收粮人')
          return;
        }
        if (!this.jine) {
          this.$message.info('请输入信息')
          return;
        }
        this.$api.post(global.apiUrls.post65d6ddfa42492, {
          aid: this.aid,
          pinzhong: this.pinzhong,
          leixing: this.state,
          shougoujia: this.shougoujia,
          maozhong: this.maozhong,
          songliangren: this.songliangren,
          pizhong: this.pizhong,
          jingzhong: this.jingzhong,
          jine: this.jine
        }).then(res => {
          if (res.data.code == 1) {
            this.saveList()
            uni.navigateBack()

            // this.popupShow1706232692826 = true
          } else {
            this.$message.info(res.data.msg)
          }
        })
      },
      saveList() {
        this.$api.post(global.apiUrls.post65d6e72c5176d, {
          shouliangrenmingcheng: this.songliangren
        }).then(res => {
          if (res.data.code == 1) {
            // this.getReson()
          }
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .releaseSale_picker1_0_c2 {
    color: rgba(37, 104, 174, 1);
  }

  .releaseSale_picker1_0_c0 {
    color: rgba(153, 153, 153, 1);
  }

  .releaseSale_picker1_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
    border-radius: 25rpx 25rpx 0rpx 0rpx;
    background-size: 100% auto !important;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(248, 248, 250, 1);
    background-size: 100% auto;
  }

  .dailyexpenditureModification_flex_0 {
    background: rgba(255, 255, 255, 1);
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto;
  }

  .dailyexpenditureModification_fd0_0_c2_c0 {
    width: 119rpx;
    height: 55rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .dailyexpenditureModification_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .dailyexpenditureModification_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .dailyexpenditureModification_fd0_0_c0 {
    width: 120rpx;
  }

  .dailyexpenditureModification_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .dailyexpenditureModification_flex_1 {
    padding: 0rpx 30rpx 0rpx 30rpx;
  }

  .dailyexpenditureModification_fd1_1_c0 {
    background: rgba(37, 104, 174, 1);
    border-radius: 55rpx;
    width: 686rpx;
    line-height: 88rpx;
    font-size: 34rpx;
    color: #fff;
  }

  .dailyexpenditureModification_fd1_1 {
    margin: 44rpx 0rpx 0rpx 0rpx;
  }

  .dailyexpenditureModification_fd1_0_c6_c2 {
    color: rgba(255, 80, 80, 1);
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0_c5_c2 {
    color: rgba(255, 80, 80, 1);
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 41rpx;
  }

  .dailyexpenditureModification_fd1_0_c5_c1 {
    color: rgba(255, 80, 80, 1);
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .dailyexpenditureModification_fd1_0_c3_c2 {
    color: #101010;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
    width: 350rpx;
  }

  .dailyexpenditureModification_fd1_0_c2_c3 {
    color: #878787;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 41rpx;
  }

  .dailyexpenditureModification_fd1_0_c1_c2 {
    width: 20rpx;
    height: 11rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 20rpx;

  }

  .dailyexpenditureModification_fd1_0_c1_c1 {
    color: #101010;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0_c1 {
    margin: 40rpx 0rpx 0rpx 0rpx;
  }

  .dailyexpenditureModification_fd1_0_c0_c3 {
    border: 1px solid rgba(16, 16, 16, 1);
    background: rgba(255, 255, 255, 1);
    margin: 0rpx 0rpx 0rpx 40rpx;
    padding: 12rpx 42rpx 12rpx 42rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: rgba(16, 16, 16, 1);
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0_c0_c2 {
    background: rgba(37, 104, 174, 1);
    margin: 0rpx 0rpx 0rpx 40rpx;
    padding: 12rpx 42rpx 12rpx 42rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: #FFFFFF;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0_c0_c1 {
    color: #666666;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0_c0_c0 {
    color: rgba(219, 68, 59, 1);
    font-size: 32rpx;
    font-weight: 400;
    line-height: 46rpx;
  }

  .dailyexpenditureModification_fd1_0 {
    background: rgba(255, 255, 255, 1);
    border-radius: 16rpx;
    background-size: 100% auto;
    padding: 32rpx 24rpx 32rpx 24rpx;
  }
</style>
